<html>
  <head>
    <title><g:message code="episodio.list.title" /></title>
    <style>
      body {
        font-family: verdana, tahoma;
        font-size: 12px;
      }
      table {
        background-color: #ffffdd;
        width: 100%;
        font-size: 12px;
        border: 1px solid #000;
      }
      th {
        background-color: #ccccdd;
      }
      td {
        text-align: center;
      }
    </style>
  </head>
  <body>
    <h1><g:message code="episodio.list.title" /></h1>
    
    <g:if test="${flash.message}">
      <div class="message">
        <g:message code="${flash.message}" args="${flash.args}" />
      </div>
    </g:if>
    
    <ul>
      <li>
        <g:link action="create">
          <g:message code="trauma.list.action.crearEpisodio" />
        </g:link>
      </li>
    </ul>
    
    <table>
      <tr>
        <th><g:message code="trauma.list.label.id" /></th>
        <th><g:message code="trauma.list.label.startTime" /></th>
        <th><g:message code="trauma.list.label.endTime" /></th>
        <th><g:message code="trauma.list.label.observations" /></th>
        <th><g:message code="trauma.list.label.actions" /></th>
      </tr>
      <g:each in="${compositions}" var="composition">
        <tr>
          <td>${composition.id}</td>
          <td><g:render template="DvDate" model="[date:composition.context.startTime]" /></td>
          <td>${composition.context.endTime}</td>
          <td>
            <%-- OJO: Solo funciona si el otherContext es ItemSingle y el value del Element es DvText --%>
            ${composition.context.otherContext.item.value.value}
          </td>
          <td>
            <g:link action="show" id="${composition.id}">Seleccionar</g:link>
          </td>
        </tr>
      </g:each>
    </table>
    <ul>
      <g:each in="${templateNames}" var="template">
        <li><g:link action="generarTemplate" params="[templateId:template]">${template}</g:link></li>
      </g:each>
    </ul>
  
  </body>
</html>